<%@include file="../common/foot.jsp" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>购物车页面</title>

    <script type="text/javascript">
        function foo(){
            if(confirm("确认删除吗？")){
                return true;
            }
            return false;
        }
    </script>
</head>
<body>
<jsp:include page="${pageContext.request.contextPath}/jsp/main/bookHead.jsp" flush="true" />
<form action="${pageContext.request.contextPath}/jsp/user/user.do?addToOrder" method="post">
    <input class="btn btn-info text-white form-control myButtonInput" type="submit" value="提交订单">
    <table class="table table-hover table-bordered">
        <tr>
            <th width="10%">选择</th>
            <th width="10%">书名</th>
            <th width="10%">作者</th>
            <th width="10%">出版社</th>
            <th width="20%">书本图片</th>
            <th width="10%">单价(元)</th>
            <th width="10%">数量(个)</th>
            <th width="20%">操作</th>
        </tr>
        <tbody>
        <c:forEach var="book" items="${books}" varStatus="status">
            <tr>
                <td>
                    <span><input type="checkbox" name="choice" value="${book.id}"></span>
                </td>
                <td>
                    <span>${book.name}</span>
                </td>
                <td>
                    <span>${book.author}</span>
                </td>
                <td>
                    <span>${book.press}</span>
                </td>
                <td>
                    <c:if test="${book.picture == null || book.picture == ''}">
                        <span><img src="${pageContext.request.contextPath}/image/bookImage/nullBook.png" height="300" width="200"></span>
                    </c:if>
                    <c:if test="${book.picture != null && book.picture != ''}">
                        <span><img src="${pageContext.request.contextPath}/image/bookImage/${book.picture}" height="300" width="200"></span>
                    </c:if>
                </td>
                <td>
                    <span>${book.price}</span>
                </td>
                <td>
                    <span><input type="text" name="quantity" value="1"></span>
                </td>
                <td>
                    <a href="${pageContext.request.contextPath}/jsp/user/user.do?method=deleteCart&bid=${book.id}" onclick="return foo()">
                        <input type="button" class="btn btn-lg btn-danger" value="删除">
                    </a>
                </td>
            </tr>
        </c:forEach>
        </tbody>

    </table>

</form>

</body>
</html>
